﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace YBOT_Field_Control
{
    class TeamVariables
    {
        public TowerVariables tower;
        public int score;
        public int nestEggs;
        public int panEggs;
        public int panTotal;
        public int nestTotal;
        public int feedCount;
        public int autoCount;
        public int finalScore;
        public int penalty;
        public bool dq;
        public string matchResult;
        public bool correct;
        public int autoMaxTimes = 6;

        public void setTowers(int control_tower, int candle_input, int nest_tower, int pan_tower, int blue_feed_tower, int yellow_feed_tower)
        {
            this.tower = new TowerVariables(control_tower, candle_input, nest_tower, pan_tower, blue_feed_tower, yellow_feed_tower);
        }

        public void reset()
        {
            score = 0;
            nestEggs = 0;
            panEggs = 0;
            nestEggs = 0;
            feedCount = 0;
            autoCount = 0;
            finalScore = 0;
            penalty = 0;
            dq = false;
            matchResult = null;
            correct = false;
        }

        public int randomNum(int lowNum, int highNum)
        {
            int _time = DateTime.Now.Second;
            Random newNum = new Random(_time);
            return newNum.Next(lowNum, highNum+1);
        }

    }

    struct TowerVariables
    {
        public int controlTower;
        public int controllerRelay = 4;
        public int candleInput;
        public int candleLight = 1;
        public int nestTower;
        public int panTower;
        public int blueFeedTower;
        public int yellowFeedTower;
        public int blueFeedLight = 3;
        public int yellowFeedLight = 4;
        public int randomTower = 0;
        public int randomLight = 0;

        public TowerVariables(int control_tower, int candle_input, int nest_tower, int pan_tower, int blue_feed_tower, int yellow_feed_tower)
        {
            controlTower = control_tower;
            candleInput = candle_input;
            nestTower = nest_tower;
            panTower = pan_tower;
            blueFeedTower = blue_feed_tower;
            yellowFeedTower = yellow_feed_tower;
        }

        public int flipFeedTower(int currentTower)
        {
            if (currentTower == this.blueFeedTower) return this.yellowFeedTower;
            else return this.blueFeedTower;
        }

    }
}
